# Contributor: alpterry <alpterry@protonmail.com>
# Maintainer: alpterry <alpterry@protonmail.com>
pkgname=supertux
pkgver=0.6.3
pkgrel=6
pkgdesc="Open-source classic 2D jump'n run sidescroller game"
url="https://www.supertux.org/"
arch="all !s390x" # build fails
license="GPL-3.0-or-later"
depends="$pkgname-data"
makedepends="
	boost-dev
	cmake
	curl-dev
	freetype-dev
	glew-dev
	glm-dev
	libpng-dev
	libvorbis-dev
	openal-soft-dev
	physfs-dev
	samurai
	sdl2-dev
	sdl2_image-dev
	"
subpackages="$pkgname-doc $pkgname-data::noarch"
options="!check" # no test suite
source="https://github.com/SuperTux/supertux/releases/download/v$pkgver/SuperTux-v$pkgver-Source.tar.gz
	missing-include-for-FLT_EPSILON.patch
	gcc12.patch
	"
builddir="$srcdir/SuperTux-v$pkgver-Source"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		-DINSTALL_SUBDIR_BIN=bin \
		$CMAKE_CROSSOPTS
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

data() {
	pkgdesc="$pkgdesc (data files)"

	amove usr/share/games
}

sha512sums="
c6540bab1b3befbd975756031c4587e5569d9613d9539dc829c728b574d1a4da92816d6a7e68947b32963cc13d9b8b52312701c199138640e9f89e5885433798  SuperTux-v0.6.3-Source.tar.gz
4e4116cb0dc7f996cdb96484eac99bd7f5a16829f6b082cc2e4c17b22e6e2f34501b8e3e4caf3c956369c5cd6caa12179b8a4cb1f93c2c8c8b014e3829272cb3  missing-include-for-FLT_EPSILON.patch
11163eaa77a226279445e221ff515874849eb4441aae6ae5eaaee348373d6333887798d53e637b6d8b21c94744357f9eab63f7811fe1cd0ba808c6c8e4470b5c  gcc12.patch
"
